import org.powerbot.core.script.job.Task;
import org.powerbot.core.script.job.state.Node;
import org.powerbot.game.api.methods.interactive.Players;
import org.powerbot.game.api.methods.node.GroundItems;
import org.powerbot.game.api.methods.tab.Inventory;
import org.powerbot.game.api.methods.widget.Camera;
import org.powerbot.game.api.util.Random;
import org.powerbot.game.api.wrappers.interactive.Player;
import org.powerbot.game.api.wrappers.node.GroundItem;


public class Loot extends Node
{

	@Override
	public boolean activate() {
		return 	false;//GroundItems.getNearest(FireGiant.lootTable) != null 
				//&& Players.getLocal() != null;
	}

	@Override
	public void execute() {
		final GroundItem items = GroundItems.getNearest(FireGiant.lootTable);
		final Player p = Players.getLocal();
		if(items!=null)
		{
			System.out.println("Looting");
			if(items.isOnScreen())
			{
				items.interact("Take", items.getGroundItem().getName());
				Task.sleep(Random.nextInt(200, 400));
			}
			else 
			{
				Camera.turnTo(items);
			}
		}
	}
}
